﻿@model SILAS.Entidades.FuenteAgua

@{
    ViewBag.Title = "Edit";
    Layout = "~/Views/Shared/_LayoutGeneral.cshtml";
}
@section js{

    <script type="text/javascript">

        $(function () {

            $("#btncrear").click(function () {

                var data = $('form').serialize();

                $.post('@Url.Action("Edit", "FuenteAgua")',
                         data,
                         function (ok) {
                             if (ok) {
                                 if (ok.exito == true) {
                                     alert(ok.msg);
                                     window.location = '@Url.Action("Index", "FuenteAgua")';
                                 }
                                 else {
                                     alert(ok.msg);
                                 }
                             }
                         }, "json");
            });

        });
        

    </script>
}

<h4><b>Editar Datos De la Fuente de Agua</b></h4>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Fuente de Agua</legend>

        @Html.HiddenFor(model => model.Id)

        <div class="editor-label">
            @Html.LabelFor(model => model.Denominacion)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Denominacion)
            @Html.ValidationMessageFor(model => model.Denominacion)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Caudal)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Caudal)
            @Html.ValidationMessageFor(model => model.Caudal)
        </div>

        <div class="editor-label">
            @Html.Label("Dueño")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Duenio)
            @Html.ValidationMessageFor(model => model.Duenio)
        </div>

        <div class="editor-label">
            @Html.Label("Tipo de Fuente")
        </div>
        <div class="editor-field">
           @Html.DropDownList("IdTipoFuente")
            @Html.ValidationMessageFor(model => model.IdTipoFuente)
        </div>
         @Html.HiddenFor(model=>model.IdUbicacion)
         <div class="editor-label">
            @Html.Label("Altura")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Ubicacion.Altura)
            @Html.ValidationMessageFor(model => model.Ubicacion.Altura)
        </div>

        <div class="editor-label">
            @Html.Label("Latitud (Coor X)")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Ubicacion.CoorX)
            @Html.ValidationMessageFor(model => model.Ubicacion.CoorX)
        </div>

         <div class="editor-label">
            @Html.Label("Longitud (Coor Y)")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Ubicacion.CoorY)
            @Html.ValidationMessageFor(model => model.Ubicacion.CoorY)
        </div>

         <p>
            <button id="btncrear" type="button">Modificar Fuente de Agua</button> 
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Regresar", "Index")
</div>
